package xyz.o0o0o.demo.RedisDemo;

import java.io.IOException;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;

/**
 * Hello world!
 *
 */
public class App {
	public static void main(String[] args) throws IOException {
		testPipeline();
	}

	public static void testPipeline() throws IOException {
		Jedis jedis = new Jedis("localhost");

		long begin = System.currentTimeMillis();
		Pipeline p = jedis.pipelined();
		for (int i = 0; i < 100000; i++) {
			p.ping();
		}
		p.close();
		System.out.println("with Pipeline cost time :" + (System.currentTimeMillis() - begin));

		begin = System.currentTimeMillis();
		for (int i = 0; i < 100000; i++) {
			jedis.ping();
		}
		System.out.println("without Pipeline cost time :" + (System.currentTimeMillis() - begin));
	}

}
